<?php

class Util{

    public static function getMappingClassNameArray($autoInclude = null){
        $fileNameAppend = '.class.php';
        $classFiles = array();
        $classDirs = array(dirname(__FILE__).'/Mapping/',dirname(__FILE__).'/../../custom_oo/classes/Mapping/');
        $includeAs = 'classes/Mapping/';
        foreach ($classDirs as $dir){
            $dh = opendir($dir);
            $i = 0;
            if (!is_dir($dir)){
                throw new Exception('Not a directory: ['.$dir.']');
            }
            while ( ! is_bool( $file = readdir ( $dh ) ) ){
                if (!is_dir ( $dir.$file ) && strpos($file,$fileNameAppend) !== false){
                    $classFiles[] = str_replace($fileNameAppend,'',$file);
                    if ($autoInclude === true){
                        require_once($includeAs.$file);
                    }
                }
            }
            closedir($dh);
        }
        return $classFiles;
    }

}

?>